<template>
    <a-table rowKey="id" size="small" :columns="tableColumns" :data-source="list" :pagination="false">
        <template #label="{ record }">
            {{ record.auditLabel || record.delayLabel }}
        </template>
        <template #action="{ record }">
            <a @click="jumpTo(record)">详情</a>
        </template>
    </a-table>
</template>

<script lang="ts">
import store from '@/store';
import { getOtherPlatformIp } from '@/utils/util';
import { defineComponent } from 'vue';
export default defineComponent({
    props: {
        detail: { type: Object, default: () => ({}) },
        list: {
            type: Array,
            default: () => []
        }
    },
    emits: ['deleteHandle', 'success'],
    setup() {
        const tableColumns: Recordable[] = [
            {
                title: '测试版本名称',
                dataIndex: 'requestName'
            },
            {
                title: '状态',
                dataIndex: 'requestStatus'
            },
            {
                title: '意见',
                dataIndex: 'approvalAdvice',
                ellipsis: true,
                width: 200
            },
            {
                title: '标签',
                dataIndex: 'label',
                slots: { customRender: 'label' }
            },
            {
                title: '提测时间',
                dataIndex: 'createTime'
            },
            {
                title: '操作',
                dataIndex: 'action',
                slots: { customRender: 'action' }
            }
        ];
        const jumpTo = ({ id, actId }) => {
            const ip = getOtherPlatformIp('acmdb');
            const json = JSON.stringify({
                type: 'pmp'
            });
            const url = `${ip}/#/reqManage/reqDetail?actId=${id}&processId=${actId}&ssoToken=${store.getters.token}&json=${json}`;
            window.open(url, '_blank');
        };
        return {
            tableColumns,
            jumpTo
        };
    }
});
</script>

<style scoped lang="less">
::v-deep(.ant-table-row) {
    p {
        margin: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
.canEdit {
    cursor: pointer;
    color: @primary-color;
}
.disabledEdit {
    cursor: not-allowed;
    color: @disable-font-color;
}
.opinion-cont {
    white-space: pre-wrap;
    color: @error-color;
}
</style>